/**
 * ----------------------------------------------------------------------------
 * Copyright Jens Konopka
 * 
 * Alle Rechte vorbehalten.
 * Licence: Apache 2.0
 * ----------------------------------------------------------------------------
 *
 * created on 06.03.2012 by jk
 */
package de.sql.toolkit.generator;

import java.io.File;

import de.sql.toolkit.model.Table;
import de.sql.toolkit.util.StringUtil;

/**
 * @author jk
 *
 */
public class CSharpModelGenerator extends JvModelGenerator {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4954011198155782190L;

	/**
	 * @param dstPath
	 * @param table
	 * @param namespace
	 */
	public CSharpModelGenerator(File dstPath, Table table, String namespace) {
		super(dstPath, table, namespace);
	}

	/* (non-Javadoc)
	 * @see de.sql.toolkit.generator.JvModelGenerator#generate()
	 */
	@Override
	public String generate() throws Exception {
		final StringBuilder content = new StringBuilder();
		content.append("namespace ");
		content.append(getNamespace());
		content.append("\n{\n");
		content.append("\tpublic class ");
		content.append(StringUtil.upperCaseFirstLetters(getTable().getName()));
		content.append("\n\t{\n");

		for (final AbstractJvModelGenerator writer : getWriter()) {
			content.append(writer.generate());
		}

		content.append("\t}\n");
		content.append("}\n");
		return content.toString();
	}

}
